#!/usr/bin/env bash
cd /var/lib/docker/containers/
list=`find|grep json.log$`
now=`date -d '1 days ago' "+%Y%m%d"`

for file in ${list}
do
    cp ${file} "${file}.${now}.bak"
    echo "">${file}
done

find -mtime +5 -type f -name '*[0-9].bak' |xargs rm -rf


#
#0 2 *  *  *  sh /root/wolferhua/log.sh